<template>
  <div>
    <el-tooltip placement="right-start" effect="light" popper-class="tooltip">
      <div slot="content">
        <ul class="table_ul">
          <li class="clr_666" @click="singleMatchFn(ChosedRowItem)" v-if="ChosedRowItem.match_state === 1 && hasPerimission('yxpp')"><span>重新匹配</span></li>
          <li class="clr_666" @click="singleMatchFn(ChosedRowItem)" v-else-if="hasPerimission('yxpp')&&(ChosedRowItem.match_state === -1 ||ChosedRowItem.match_state === 0 )"><span>匹配</span></li>
          <li class="clr_666" v-if="hasPerimission('yxfs')" @click="singleTranspondFn(ChosedRowItem)"><span>转发</span></li>
          <li class="clr_666" v-if="hasPerimission('yxxg')" @click="modifyFn(ChosedRowItem)"><span>修改</span></li>
          <li class="clr_666" v-if="hasPerimission('yxsc')" @click="deleteImg(ChosedRowItem)"><span>删除</span></li>
<!--          <li class="clr_666" @click="singleMatchFn(ChosedRowItem)"><span>匹配</span></li>-->
          <li class="clr_666" v-if="hasPerimission('yxcf')" @click="splitFn(ChosedRowItem)"><span>拆分</span></li>

          <!-- v-if="hasPerimission('yxdr') 要判断是否有转发权限的-->
          <!-- <li class="clr_666" @click="singleSendImg(ChosedRowItem)"><span>转发</span></li> -->
        </ul>
      </div>
      <div class="clr_0a70b0 fl f14">更多</div>
    </el-tooltip>
  </div>
</template>

<script>
import { mapGetters } from 'vuex'

  export default {
    name: 'imgListTableOperateBtn',
    props: ['ChosedRowItem'],
    computed:{
      ...mapGetters(['group', 'permissions',]),
    },
    methods: {
      // 是否有权限
    hasPerimission(permissionName) {
      if (this.group === 'tenancy') {
        return true
      }
      return this.permissions.includes(permissionName)
    },
      singleMatchFn(rowItem) {
        this.$emit('singleMatchFn', rowItem)
      },
      modifyFn(rowItem) {
        this.$emit('modifyFn', rowItem)
      },
      splitFn(rowItem) {
        this.$emit('splitFn', rowItem)
      },

      //转发--单条
      singleTranspondFn(rowItem){
        
        this.$emit('singleTranspondFn', rowItem)

      },
      // 单条转发
      singleSendImg(rowItem) {
        this.$emit('singleSendImg', rowItem)
      },
      // 单条匹配
      singleMatchFn(rowItem) {
        this.$emit('singleMatchFn', rowItem)
      },
      deleteImg(rowItem) {
        this.$emit('singleDelete', rowItem.id)
      }
    }
  }
</script>

<style lang="less" scoped>
.table_ul {
  li {
    height: 38px;
    line-height: 38px;
    font-size: 16px;
    padding-left: 10px;
    padding-right: 10px;
    cursor: pointer;
    width: 105px;
    text-align: center;
    border-bottom: 1px solid #eee;
    &:last-child {
      border-bottom: none;
    }
  }
}
</style>
